﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Finbook.GameApp.Models.V3
{
    public class Player
        : RoleV3
    {
        public Player(int hp)
            : base(hp)
        { }

        public override Skill SelectSkill()
        {
            var bSuccess = false;
            int index = 0;
            while (!bSuccess)
            {
                Console.WriteLine($"请选择您的技能{1}~{Skills.Count}");
                var input = Console.ReadLine();
                if (!string.IsNullOrEmpty(input))
                {
                    if (int.TryParse(input, out index))
                    {
                        if (index<=0||index>Skills.Count)
                        {
                            bSuccess = false;
                        }
                        else
                        {
                            bSuccess = true;
                        }
                    }
                    else
                    {
                        bSuccess = false;
                    };
                }
                else
                {
                    bSuccess = false;
                }
            }
            return Skills[index-1];
        }
    }
}
